<?php

/**
 * This is the model class for table "verticalexits".
 *
 * The followings are the available columns in table 'verticalexits':
 * @property integer $Id
 * @property double $MainStairwayWidth
 * @property string $MainStairwayConstruction
 * @property integer $MainStairwayAreThereRailingsProvided
 * @property string $MainStairwayMadeOf
 * @property integer $MainStairwayAnyEnclosureProvided
 * @property string $MainStairwayEnclosureConstruction
 * @property integer $MainStairwayAnyOpening
 * @property string $MainStairwayFireDoorConstruction
 * @property integer $MainStairwayDoorEquippedWithSelfClosingDevice
 * @property integer $MainStairwayDoorProperRating
 * @property integer $MainStairwayDoorProvidedWithVisionPanel
 * @property string $MainStairwayIfYesMadeOf
 * @property integer $MainStairwayDoorSwingInTheDirectionOfExitTravel
 * @property integer $MainStairwayStairwaysPressurized
 * @property string $MainStairwayIfPressurizedWhatTypeOrMethod
 * @property string $MainStairwayDateLastTested
 * @property integer $FireEscapeNumber
 * @property double $FireEscapeWidth
 * @property string $FireEscapeConstruction
 * @property integer $FireEscapeAreThereRailingsProvided
 * @property string $FireEscapeRailingMadeOf
 * @property integer $FireEscapeLocation
 * @property integer $FireEscapeExitsAccessible
 * @property integer $FireEscapeAnyObstruction
 * @property string $FireEscapeTerminationOrDischargeOfExits
 * @property integer $FireEscapeAnyEnclosureProvided
 * @property string $FireEscapeEnclosureConstruction
 * @property integer $FireEscapeAnyOpening
 * @property integer $FireEscapeOpeningProtected
 * @property integer $FireEscapeAreFireDoorProvided
 * @property double $FireEscapeDoorWidth
 * @property string $FireEscapeFireDoorConstruction
 * @property integer $FireEscapeDoorProvidedWithVisionPanel
 * @property string $FireEscapeIfYesMadeOf
 * @property integer $FireEscapeDoorEquippedWithSelfClosingDevice
 * @property integer $FireEscapeDoorAndClosureProperRating
 * @property integer $FireEscapeDoorsOpenEasily
 * @property integer $FireEscapeSelfClosingDeviceOperable
 * @property integer $FireEscapeDoorEquippedWithPanicHardware
 * @property integer $FireEscapeOperable
 * @property integer $FireEscapeDoorSwingingInTheDirectionOfExitTravel
 * @property integer $FireEscapeEnclosureProperlyProtected
 * @property integer $FireEscapeFireEscapePressurized
 * @property string $FireEscapeIfPressurizedWhatType
 * @property string $FireEscapeDateLastTested
 * @property integer $Establishment_Id
 *
 * The followings are the available model relations:
 * @property Establishments $establishment
 */
class Verticalexits extends CActiveRecord
{
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'verticalexits';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('MainStairwayAreThereRailingsProvided, MainStairwayAnyEnclosureProvided, MainStairwayAnyOpening, MainStairwayDoorEquippedWithSelfClosingDevice, MainStairwayDoorProperRating, MainStairwayDoorProvidedWithVisionPanel, MainStairwayDoorSwingInTheDirectionOfExitTravel, MainStairwayStairwaysPressurized, FireEscapeNumber, FireEscapeAreThereRailingsProvided, FireEscapeLocation, FireEscapeExitsAccessible, FireEscapeAnyObstruction, FireEscapeAnyEnclosureProvided, FireEscapeAnyOpening, FireEscapeOpeningProtected, FireEscapeAreFireDoorProvided, FireEscapeDoorProvidedWithVisionPanel, FireEscapeDoorEquippedWithSelfClosingDevice, FireEscapeDoorAndClosureProperRating, FireEscapeDoorsOpenEasily, FireEscapeSelfClosingDeviceOperable, FireEscapeDoorEquippedWithPanicHardware, FireEscapeOperable, FireEscapeDoorSwingingInTheDirectionOfExitTravel, FireEscapeEnclosureProperlyProtected, FireEscapeFireEscapePressurized, Establishment_Id', 'numerical', 'integerOnly'=>true),
			array('MainStairwayWidth, FireEscapeWidth, FireEscapeDoorWidth', 'numerical'),
			array('MainStairwayConstruction, MainStairwayMadeOf, MainStairwayEnclosureConstruction, MainStairwayFireDoorConstruction, MainStairwayIfYesMadeOf, MainStairwayIfPressurizedWhatTypeOrMethod, FireEscapeConstruction, FireEscapeRailingMadeOf, FireEscapeTerminationOrDischargeOfExits, FireEscapeEnclosureConstruction, FireEscapeFireDoorConstruction, FireEscapeIfYesMadeOf, FireEscapeIfPressurizedWhatType', 'length', 'max'=>45),
			array('MainStairwayDateLastTested, FireEscapeDateLastTested', 'safe'),
			// The following rule is used by search().
			// @todo Please remove those attributes that should not be searched.
			array('Id, MainStairwayWidth, MainStairwayConstruction, MainStairwayAreThereRailingsProvided, MainStairwayMadeOf, MainStairwayAnyEnclosureProvided, MainStairwayEnclosureConstruction, MainStairwayAnyOpening, MainStairwayFireDoorConstruction, MainStairwayDoorEquippedWithSelfClosingDevice, MainStairwayDoorProperRating, MainStairwayDoorProvidedWithVisionPanel, MainStairwayIfYesMadeOf, MainStairwayDoorSwingInTheDirectionOfExitTravel, MainStairwayStairwaysPressurized, MainStairwayIfPressurizedWhatTypeOrMethod, MainStairwayDateLastTested, FireEscapeNumber, FireEscapeWidth, FireEscapeConstruction, FireEscapeAreThereRailingsProvided, FireEscapeRailingMadeOf, FireEscapeLocation, FireEscapeExitsAccessible, FireEscapeAnyObstruction, FireEscapeTerminationOrDischargeOfExits, FireEscapeAnyEnclosureProvided, FireEscapeEnclosureConstruction, FireEscapeAnyOpening, FireEscapeOpeningProtected, FireEscapeAreFireDoorProvided, FireEscapeDoorWidth, FireEscapeFireDoorConstruction, FireEscapeDoorProvidedWithVisionPanel, FireEscapeIfYesMadeOf, FireEscapeDoorEquippedWithSelfClosingDevice, FireEscapeDoorAndClosureProperRating, FireEscapeDoorsOpenEasily, FireEscapeSelfClosingDeviceOperable, FireEscapeDoorEquippedWithPanicHardware, FireEscapeOperable, FireEscapeDoorSwingingInTheDirectionOfExitTravel, FireEscapeEnclosureProperlyProtected, FireEscapeFireEscapePressurized, FireEscapeIfPressurizedWhatType, FireEscapeDateLastTested, Establishment_Id', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'establishment' => array(self::BELONGS_TO, 'Establishments', 'Establishment_Id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'Id' => 'ID',
			'MainStairwayWidth' => 'Main Stairway Width',
			'MainStairwayConstruction' => 'Main Stairway Construction',
			'MainStairwayAreThereRailingsProvided' => 'Main Stairway Are There Railings Provided',
			'MainStairwayMadeOf' => 'Main Stairway Made Of',
			'MainStairwayAnyEnclosureProvided' => 'Main Stairway Any Enclosure Provided',
			'MainStairwayEnclosureConstruction' => 'Main Stairway Enclosure Construction',
			'MainStairwayAnyOpening' => 'Main Stairway Any Opening',
			'MainStairwayFireDoorConstruction' => 'Main Stairway Fire Door Construction',
			'MainStairwayDoorEquippedWithSelfClosingDevice' => 'Main Stairway Door Equipped With Self Closing Device',
			'MainStairwayDoorProperRating' => 'Main Stairway Door Proper Rating',
			'MainStairwayDoorProvidedWithVisionPanel' => 'Main Stairway Door Provided With Vision Panel',
			'MainStairwayIfYesMadeOf' => 'Main Stairway If Yes Made Of',
			'MainStairwayDoorSwingInTheDirectionOfExitTravel' => 'Main Stairway Door Swing In The Direction Of Exit Travel',
			'MainStairwayStairwaysPressurized' => 'Main Stairway Stairways Pressurized',
			'MainStairwayIfPressurizedWhatTypeOrMethod' => 'Main Stairway If Pressurized What Type Or Method',
			'MainStairwayDateLastTested' => 'Main Stairway Date Last Tested',
			'FireEscapeNumber' => 'Fire Escape Number',
			'FireEscapeWidth' => 'Fire Escape Width',
			'FireEscapeConstruction' => 'Fire Escape Construction',
			'FireEscapeAreThereRailingsProvided' => 'Fire Escape Are There Railings Provided',
			'FireEscapeRailingMadeOf' => 'Fire Escape Railing Made Of',
			'FireEscapeLocation' => 'Fire Escape Location',
			'FireEscapeExitsAccessible' => 'Fire Escape Exits Accessible',
			'FireEscapeAnyObstruction' => 'Fire Escape Any Obstruction',
			'FireEscapeTerminationOrDischargeOfExits' => 'Fire Escape Termination Or Discharge Of Exits',
			'FireEscapeAnyEnclosureProvided' => 'Fire Escape Any Enclosure Provided',
			'FireEscapeEnclosureConstruction' => 'Fire Escape Enclosure Construction',
			'FireEscapeAnyOpening' => 'Fire Escape Any Opening',
			'FireEscapeOpeningProtected' => 'Fire Escape Opening Protected',
			'FireEscapeAreFireDoorProvided' => 'Fire Escape Are Fire Door Provided',
			'FireEscapeDoorWidth' => 'Fire Escape Door Width',
			'FireEscapeFireDoorConstruction' => 'Fire Escape Fire Door Construction',
			'FireEscapeDoorProvidedWithVisionPanel' => 'Fire Escape Door Provided With Vision Panel',
			'FireEscapeIfYesMadeOf' => 'Fire Escape If Yes Made Of',
			'FireEscapeDoorEquippedWithSelfClosingDevice' => 'Fire Escape Door Equipped With Self Closing Device',
			'FireEscapeDoorAndClosureProperRating' => 'Fire Escape Door And Closure Proper Rating',
			'FireEscapeDoorsOpenEasily' => 'Fire Escape Doors Open Easily',
			'FireEscapeSelfClosingDeviceOperable' => 'Fire Escape Self Closing Device Operable',
			'FireEscapeDoorEquippedWithPanicHardware' => 'Fire Escape Door Equipped With Panic Hardware',
			'FireEscapeOperable' => 'Fire Escape Operable',
			'FireEscapeDoorSwingingInTheDirectionOfExitTravel' => 'Fire Escape Door Swinging In The Direction Of Exit Travel',
			'FireEscapeEnclosureProperlyProtected' => 'Fire Escape Enclosure Properly Protected',
			'FireEscapeFireEscapePressurized' => 'Fire Escape Fire Escape Pressurized',
			'FireEscapeIfPressurizedWhatType' => 'Fire Escape If Pressurized What Type',
			'FireEscapeDateLastTested' => 'Fire Escape Date Last Tested',
			'Establishment_Id' => 'Establishment',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 *
	 * Typical usecase:
	 * - Initialize the model fields with values from filter form.
	 * - Execute this method to get CActiveDataProvider instance which will filter
	 * models according to data in model fields.
	 * - Pass data provider to CGridView, CListView or any similar widget.
	 *
	 * @return CActiveDataProvider the data provider that can return the models
	 * based on the search/filter conditions.
	 */
	public function search()
	{
		// @todo Please modify the following code to remove attributes that should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('Id',$this->Id);
		$criteria->compare('MainStairwayWidth',$this->MainStairwayWidth);
		$criteria->compare('MainStairwayConstruction',$this->MainStairwayConstruction,true);
		$criteria->compare('MainStairwayAreThereRailingsProvided',$this->MainStairwayAreThereRailingsProvided);
		$criteria->compare('MainStairwayMadeOf',$this->MainStairwayMadeOf,true);
		$criteria->compare('MainStairwayAnyEnclosureProvided',$this->MainStairwayAnyEnclosureProvided);
		$criteria->compare('MainStairwayEnclosureConstruction',$this->MainStairwayEnclosureConstruction,true);
		$criteria->compare('MainStairwayAnyOpening',$this->MainStairwayAnyOpening);
		$criteria->compare('MainStairwayFireDoorConstruction',$this->MainStairwayFireDoorConstruction,true);
		$criteria->compare('MainStairwayDoorEquippedWithSelfClosingDevice',$this->MainStairwayDoorEquippedWithSelfClosingDevice);
		$criteria->compare('MainStairwayDoorProperRating',$this->MainStairwayDoorProperRating);
		$criteria->compare('MainStairwayDoorProvidedWithVisionPanel',$this->MainStairwayDoorProvidedWithVisionPanel);
		$criteria->compare('MainStairwayIfYesMadeOf',$this->MainStairwayIfYesMadeOf,true);
		$criteria->compare('MainStairwayDoorSwingInTheDirectionOfExitTravel',$this->MainStairwayDoorSwingInTheDirectionOfExitTravel);
		$criteria->compare('MainStairwayStairwaysPressurized',$this->MainStairwayStairwaysPressurized);
		$criteria->compare('MainStairwayIfPressurizedWhatTypeOrMethod',$this->MainStairwayIfPressurizedWhatTypeOrMethod,true);
		$criteria->compare('MainStairwayDateLastTested',$this->MainStairwayDateLastTested,true);
		$criteria->compare('FireEscapeNumber',$this->FireEscapeNumber);
		$criteria->compare('FireEscapeWidth',$this->FireEscapeWidth);
		$criteria->compare('FireEscapeConstruction',$this->FireEscapeConstruction,true);
		$criteria->compare('FireEscapeAreThereRailingsProvided',$this->FireEscapeAreThereRailingsProvided);
		$criteria->compare('FireEscapeRailingMadeOf',$this->FireEscapeRailingMadeOf,true);
		$criteria->compare('FireEscapeLocation',$this->FireEscapeLocation);
		$criteria->compare('FireEscapeExitsAccessible',$this->FireEscapeExitsAccessible);
		$criteria->compare('FireEscapeAnyObstruction',$this->FireEscapeAnyObstruction);
		$criteria->compare('FireEscapeTerminationOrDischargeOfExits',$this->FireEscapeTerminationOrDischargeOfExits,true);
		$criteria->compare('FireEscapeAnyEnclosureProvided',$this->FireEscapeAnyEnclosureProvided);
		$criteria->compare('FireEscapeEnclosureConstruction',$this->FireEscapeEnclosureConstruction,true);
		$criteria->compare('FireEscapeAnyOpening',$this->FireEscapeAnyOpening);
		$criteria->compare('FireEscapeOpeningProtected',$this->FireEscapeOpeningProtected);
		$criteria->compare('FireEscapeAreFireDoorProvided',$this->FireEscapeAreFireDoorProvided);
		$criteria->compare('FireEscapeDoorWidth',$this->FireEscapeDoorWidth);
		$criteria->compare('FireEscapeFireDoorConstruction',$this->FireEscapeFireDoorConstruction,true);
		$criteria->compare('FireEscapeDoorProvidedWithVisionPanel',$this->FireEscapeDoorProvidedWithVisionPanel);
		$criteria->compare('FireEscapeIfYesMadeOf',$this->FireEscapeIfYesMadeOf,true);
		$criteria->compare('FireEscapeDoorEquippedWithSelfClosingDevice',$this->FireEscapeDoorEquippedWithSelfClosingDevice);
		$criteria->compare('FireEscapeDoorAndClosureProperRating',$this->FireEscapeDoorAndClosureProperRating);
		$criteria->compare('FireEscapeDoorsOpenEasily',$this->FireEscapeDoorsOpenEasily);
		$criteria->compare('FireEscapeSelfClosingDeviceOperable',$this->FireEscapeSelfClosingDeviceOperable);
		$criteria->compare('FireEscapeDoorEquippedWithPanicHardware',$this->FireEscapeDoorEquippedWithPanicHardware);
		$criteria->compare('FireEscapeOperable',$this->FireEscapeOperable);
		$criteria->compare('FireEscapeDoorSwingingInTheDirectionOfExitTravel',$this->FireEscapeDoorSwingingInTheDirectionOfExitTravel);
		$criteria->compare('FireEscapeEnclosureProperlyProtected',$this->FireEscapeEnclosureProperlyProtected);
		$criteria->compare('FireEscapeFireEscapePressurized',$this->FireEscapeFireEscapePressurized);
		$criteria->compare('FireEscapeIfPressurizedWhatType',$this->FireEscapeIfPressurizedWhatType,true);
		$criteria->compare('FireEscapeDateLastTested',$this->FireEscapeDateLastTested,true);
		$criteria->compare('Establishment_Id',$this->Establishment_Id);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}

	/**
	 * Returns the static model of the specified AR class.
	 * Please note that you should have this exact method in all your CActiveRecord descendants!
	 * @param string $className active record class name.
	 * @return Verticalexits the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
}
